*1. Import data

import delimited "pausellietal.csv", varnames(1)

*2. Format variables
tab treated
gen treated_dummy=1 if treated=="1"
replace treated_dummy=0 if treated_dummy==.
destring against, replace force
destring ideology_left , replace force
destring v2x_libdem, replace force
gen interaction = china_sup*treated_dummy
egen country_code=group(country_str )
egen title_code=group(title)
gen global_south=0 if country_code ==9 | country_code ==10  | country_code ==15 | country_code ==18| country_code ==21| country_code ==25| country_code ==30| country_code ==32| country_code ==34| country_code ==40| country_code ==43| country_code ==44| country_code ==47| country_code ==50| country_code ==51| country_code ==55| country_code ==56| country_code ==58| country_code ==64| country_code ==67| country_code ==70| country_code ==80| country_code ==85| country_code ==92| country_code ==93| country_code ==94| country_code ==95 | country_code == 101| country_code == 102| country_code == 105| country_code ==106 | country_code == 109 | country_code == 115| country_code == 116| country_code ==117
replace global_south =1 if global_south ==.
gen placebo_treated = treated_dummy
replace placebo_treated =0 if year ==2014
replace placebo_treated =1 if year ==2013
tab placebo_treated
tabstat treated_dummy , by(year)
tabstat treated_dummy placebo_treated  , by(year)
replace treated_dummy  =1 if year ==2008
replace treated_dummy  =1 if year ==2017
replace placebo_treated =1 if year==2008
replace placebo_treated =1 if year==2017
tabstat treated_dummy placebo_treated , by(year)
replace oda=oda/1000000
replace chinese_fdi = chinese_fdi/1000000
gen random=1 if random_resolutions =="Yes"
replace random=0 if random==.
destring treated_india , replace force
gen india_sup=1 if india_support =="Yes"
replace india_sup=0 if india_support =="No"


*3. Install CEM package 
ssc install cem, replace 


*Table A.8: Logistic regression with matched observations by topic of resolution and country
cem topic1 (#48) country_code (#121), treatment(treated_dummy)
	*All resolutions
logit against  china_sup##i.treated_dummy  oda_cn chinese_fdi agree_china ideology_left v2x_libdem  i.treated_dummy [iweight=cem_weights] , vce(cluster year)
estimates store m1
	*Country resoolutions
logit against  china_sup##i.treated_dummy oda_cn chinese_fdi agree_china ideology_left v2x_libdem i.treated_dummy [iweight=cem_weights] if country_target_filt =="1", vce(cluster year)
estimates store m2

esttab m1 m2, se eform aic

*Table A.9: Univariate balance test
imb topic1 country_code, treatment(treated_dummy)
